import router from '@/router'
import store from '@/store'

// 前置导航守卫
router.beforeEach((to, from, next) => {
  // 需要登录的路由，地址是 /member 开头
  const { profile } = store.state.user
  if(!profile.token && to.path.startsWith('/member')) {
    return next('/login?redirectUrl='+to.fullPath)
  }
  next()
})